<?php


namespace App\Models\Field;

use App\Consts\GlobalConst;

class NoteField extends BaseField
{
    // 话题
    public const TOPIC = 'topic';
    // 消息静态化
    public const MESSAGE_STATIC = 'messageStatic';

    public static function getFormats($scene = self::BASE_INFO): array
    {
        $baseFormats = [
            'id' => static function ($model) {
                return $model['note_id'];
            },
            'type',
            'user_id',
            'article_id',
            'is_deleted',
            'is_public',
            'created_at',
        ];
        $formats = [
            self::MESSAGE_STATIC => [
                'id' => static function ($model) {
                    return $model['note_id'];
                },
                'type',
                'target_type' => GlobalConst::TARGET_TYPE_NOTE,
                'is_deleted',
            ],
        ];

        return $formats[$scene] ?? $baseFormats;
    }
}
